home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: blean@ix.netcom.com (Bob Blean)
- Newsgroups: comp.lang.c++
- Subject: Re: HELP!! How to correctly pass member functions to a C function???
- Date: Sun, 14 Apr 1996 00:49:24 GMT
- Organization: Netcom
- Message-ID: <31704a89.27731156@ixnews8.ix.netcom.com>
- References: <4kf534$csn@tilde.csc.ti.com> <4kfslu$s1t@tilde.csc.ti.com>
- Reply-To: blean@ix.netcom.com
- NNTP-Posting-Host: pax-ca9-13.ix.netcom.com
- X-NETCOM-Date: Sat Apr 13 5:49:32 PM PDT 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- Chuach@dlep1.itg.ti.com (Chua Chye Heng) wrote:
-
- >Chuach@dlep1.itg.ti.com (Chua Chye Heng) wrote:
- >
- >A little more info:
- >
- >1. when I declared the method to be static, the calling went thro'
- >But I am unable to call non-static members in the static method
-
- This is similar to another message (about callbacks) recently posted.
- In both cases, what is needed:
-
- *) Your real callback function needs to be a static function so that
- "this" is not an issue for it.
-
- *) When you set up the callback, you need to arrange that it will be
- passed "this".
-
- *) Then your static function uses the "this" pointer it is passed to
- call a non-static member function, passing it any other arguments the
- callback contained. At that point, you are in a normal class member
- function and handling the callback.
-
- --Bob
-